package com.ykl.base.restful;

import lombok.Data;

import java.io.Serializable;

@Data
public class Res<T> implements Serializable {
    private int code;
    private String msg;
    private T body;

    public static <X> Res<X> of(int code, String msg, X body){
        Res<X> res =new Res<>();
        res.code=code;
        res.msg = msg;
        res.body = body;
        return res;
    }

    public static <X> Res<X> ofSeccess(X body){
        return of(0,null, body);
    }

    public static <X> Res<X> ofExcept(int code, String msg){
        return of(code, msg, null);
    }

}
